package com.qining618.cms.ucenter.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qining618.cms.ucenter.domain.Third;
import com.qining618.cms.ucenter.enums.ThirdStatusEnum;
import com.qining618.cms.ucenter.enums.ThirdTypeEnum;
import com.qining618.cms.ucenter.mapper.ThirdMapper;
import com.qining618.cms.ucenter.service.ThirdService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 * 第三方 服务实现类
 * </p>
 *
 * @author qining
 * @date 2019-09-23
 */
@Transactional(readOnly = true, rollbackFor = Exception.class)
@Service
public class ThirdServiceImpl extends ServiceImpl<ThirdMapper, Third> implements ThirdService {

    @Override
    public Third getWechatMiniInfo() {
        return this.baseMapper.selectOne(new QueryWrapper<Third>().lambda()
                .eq(Third::getType, ThirdTypeEnum.WECHAT_MINI)
                .eq(Third::getStatus, ThirdStatusEnum.ENABLED));
    }
}
